<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>来查查健康</title>
    <link  rel="stylesheet"  href="css/bootstrap.css">
    <script src="../src/static/jquery.js"></script>
    <script src="js/bootstrap.js"></script>
    <script src="js/pinchzoom.js"></script>
    <link rel="stylesheet" href="css/productSupport.css">
</head>
<body>
<div class="container">
    <div class="pinch-zoom">
        <img src="img/HTML_1.png"  style="width: 100%;height: 100%"/>
        <img src="img/HTML_2.png" style="width: 100%;height: 100%"/>
        <img src="img/HTML_3.png"  style="width: 100%;height: 100%"/>
        <img src="img/HTML_4.png" style="width: 100%;height: 100%"/>
        <img src="img/HTML_5.png"  style="width: 100%;height: 100%"/>
        <div class="ns" id="liuyan" >
            <span class="fontSize">免费加入</span>
        </div>
        <form role="form"  >
            <div class="form-group">
                <div class="col-lg-4">
                    <input type="text" class="form-control" id="name" placeholder="请输入您的姓名">
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-4">
                    <input type="text" class="form-control" id="phone" placeholder="请输入您的电话">
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-4">
                    <textarea class="form-control" rows="3" id="ly" placeholder="请输入您的留言"></textarea>
                </div>
            </div>
            <div class="ns">
                <button type="button" onclick="dianji()" class="btn btn-primary btn-lg btn-block cl">提交</button>
            </div>
        </form>
        <img src="img/HTML_6.png"  id="mg" style="width: 100%;height: 100%"/>
    </div>
</div>
<div class="btn-group btn-group-lg ns navbar-fixed-bottom">
    <a type="button" class="btn btn-primary bs" href="#liuyan">咨询留言</a>
    <a type="button" class="btn btn-primary bs" href="tel:021-60127779">免费咨询热线</a>
</div>

<script>
    function yanzheng() {
        if ($('#phone').val().length !== 11) {
            alert("手机号码输入格式错误！");
            return false;
        } else if ($('#name').val() == null || $('#name').val() == "") {
            alert("输入姓名不能为空！");
            return false;
        } else if ($('#ly').val() == null || $('#ly').val() == "") {
            alert("输入留言不能为空！");
            return false;
        }
        return true;
    }

    function dianji() {
        var flg = yanzheng();
        if(flg == true){
            var phone = $('#phone').val();
            var name = $('#name').val();
            var words = $('#ly').val();
            $.ajax(
                {
                    url: '/api/addUserWords',
                    data: {
                        phone: phone,
                        name: name,
                        words: words
                    },
                    type: 'POST',
                    dataType: 'json',
                    success: function (data) {
                        alert(data.msg);
                        window.location.reload();
                    },
                    error: function (error) {
                        //请求失败  获取的报错信息
                        console.log(error);
                    }
                }
            );
        }

    }
</script>

<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
    window.onload=function(){
        $.ajax({
            url:'/api/weixinProductConfig',
            dataType:'json',
            type:'GET',
            success:function (ress) {
                wx.config({
                    debug: false,
                    appId: ress.appid,
                    timestamp: ress.timestamp,
                    nonceStr: ress.noncestr,
                    signature: ress.signature,
                    jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage']
                });
                wx.ready(function () {
                    console.log('分享前')
                    wx.onMenuShareTimeline({
                        title: "来查查智能健康检测仪",
                        link: "http://fb.dingxishebei.com/putIn/productSupport.html",
                        imgUrl: "http://fb.dingxishebei.com/putIn/img/wxlogo2.jpg",
                        success: function (res) {
                            console.log('已分享');
                        },
                        cancel: function (res) {
                            console.log('已取消');
                        },
                        fail: function (res) {
                            console.log(JSON.stringify(res));
                        }
                    });

                    wx.onMenuShareAppMessage({
                        title: "来查查智能健康检测仪",
                        desc: "快速，全面，一站式智能健康检查设备,在等你！",
                        link: "http://fb.dingxishebei.com/putIn/productSupport.html",
                        imgUrl: "http://fb.dingxishebei.com/putIn/img/wxlogo2.jpg",
                        success: function (res) {
                            console.log('已分享');
                        },
                        cancel: function (res) {
                            console.log('已取消');
                        },
                        fail: function (res) {
                            console.log(JSON.stringify(res));
                        }
                    });

                });
            },

            error: function (error) {
                //请求失败  获取的报错信息
                console.log(error);
            }
        })
    }
</script>
<script type="text/javascript">
    $(function () {
        $('div.pinch-zoom').each(function () {
            new RTP.PinchZoom($(this), {});
        });
    })
</script>
</body>
</html>